import requests
IPADDRESS = "localhost" #Replace this with the correct IP address
UNSTRUCTURED_DATA_PORT = "8086"
# URL of the API endpoint
url = f'http://{IPADDRESS}:{UNSTRUCTURED_DATA_PORT}/documents'

# Send the GET request
response = requests.get(url)

# Print the response from the server
print(f'Response Status Code: {response.status_code}')
#print(response.json())

# Check if the request was successful
if response.status_code == 200:
    data = response.json()
    documents = data.get('documents', [])

    # Format and print the list of documents
    print("Available Documents:")
    for idx, document in enumerate(documents, start=1):
        print(f"{idx}. {document}")
else:
    print(f"Failed to retrieve documents. Status Code: {response.status_code}")